var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("EventManager"),
    a = e("AudioManager"),
    i = cc._decorator,
    r = i.ccclass,
    s =
        (i.property,
        (function (e) {
            function t() {
                var t = (null !== e && e.apply(this, arguments)) || this;
                return (t.bindEventDic = {}), t;
            }
            return (
                __extends(t, e),
                (t.prototype.onLoad = function () {
                    for (var e = this.node.getComponentsInChildren(cc.Button), t = 0; t < e.length; t++)
                        e[t].node.on("click", this.OnClick, this);
                }),
                (t.prototype.onEnable = function () {
                    this.initView(), this.addEvent();
                }),
                (t.prototype.initView = function () {}),
                (t.prototype.addEvent = function () {}),
                (t.prototype.removeEvent = function () {}),
                (t.prototype.OnClick = function () {
                    a.default.ButtonSound();
                }),
                (t.prototype.emitEvent = function (e, t) {
                    n.EventManager.raiseEvent(e, t);
                }),
                (t.prototype.attachEvent = function (e, t, o) {
                    this.bindEventDic[e] ||
                        ((this.bindEventDic[e] = {func: t, target: o}),
                        o ? n.EventManager.addEventListener(e, t, o) : n.EventManager.addEventListener(e, t));
                }),
                (t.prototype.detachEvents = function () {
                    for (var e in this.bindEventDic) {
                        var t = this.bindEventDic[e];
                        t.target
                            ? n.EventManager.removeEventListener(e, t.func, t.target)
                            : n.EventManager.removeEventListener(e, t.func);
                    }
                }),
                (t.prototype.onDisable = function () {
                    this.removeEvent(), this.detachEvents();
                }),
                __decorate([r], t)
            );
        })(cc.Component));
o.default = s;
